package yuesefu;

import java.util.ArrayList;
import java.util.List;

public class Client3 {

	public static void main(String[] args) {
		List<Integer> huan=new ArrayList<Integer>();
		
		for(int i=0;i<8;i++){
			huan.add(i);
		}
		System.out.println(huan);
		int indexRemove=0;
		while(huan.size()>1){
			
			Integer rNext=huan.get((indexRemove+1)==huan.size()?0:indexRemove+1);
			Integer r=huan.remove(indexRemove);
			System.out.println(r+" jump");
			System.out.println(huan);
			indexRemove=huan.indexOf(rNext);
			System.out.println(rNext+": "+indexRemove);
			for(int j=0;j<2;j++){
				
				if(indexRemove==huan.size()-1){
					indexRemove=0;
				}else{
					indexRemove++;
					
				}
			}
			
		}
        System.out.println(huan);

	}

}
